#include "StdAfx.h"
#include "AudioDlg.h"


LRESULT AudioDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	/*
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);
	*/
	return true;
}
LRESULT AudioDlg::OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
	RECT	rect;
	GetClientRect(&rect);
	rect.bottom/=2;
	rect.bottom-=40;
	GetDlgItem(IDC_STATIC_AUDIOSHOW).MoveWindow(&rect);
	RECT	rc;
	rc.top = rect.bottom+10;
	rc.left = rect.right-100;
	rc.right = rc.left+40;
	rc.bottom = rc.top+25;
	GetDlgItem(IDC_BUTTON_ACCEPT).MoveWindow(&rc);
	rc.left = rc.right+10;
	rc.right = rc.left+40;
	GetDlgItem(IDC_BUTTON_HANGUP).MoveWindow(&rc);
	return 0;
}
LRESULT AudioDlg::OnAccept(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{	
	GetDlgItem(IDC_BUTTON_ACCEPT).ShowWindow(SW_HIDE);
	SendMessage(::GetParent(::GetParent(m_hWnd)),WM_MSG_AUDIO_ACCEPT,0,(LPARAM)this);
	return 0;
}
LRESULT AudioDlg::OnHangUp(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	SendMessage(::GetParent(::GetParent(m_hWnd)),WM_MSG_AUDIO_HANGUP,0,(LPARAM)this);
	return 0;
}
void AudioDlg::SetInitiative(bool bi)
{
	if(bi)
	{
		GetDlgItem(IDC_BUTTON_ACCEPT).ShowWindow(SW_HIDE);
	}
	else
	{
		GetDlgItem(IDC_BUTTON_ACCEPT).ShowWindow(SW_SHOW);
		GetDlgItem(IDC_BUTTON_HANGUP).ShowWindow(SW_SHOW);
	}
}
void AudioDlg::SetVideoIng(bool bing)
{
	if(bing)
	{
		GetDlgItem(IDC_BUTTON_ACCEPT).ShowWindow(SW_HIDE);
	}
	else
	{
		GetDlgItem(IDC_BUTTON_ACCEPT).ShowWindow(SW_SHOW);
		GetDlgItem(IDC_BUTTON_HANGUP).ShowWindow(SW_SHOW);
	}
}